package com.iflytek.mytest;

import java.util.ArrayList;

import com.iflytek.cloud.speech.SpeechError;
import com.iflytek.cloud.speech.SpeechEvent;
import com.iflytek.cloud.speech.SynthesizerListener;
import com.iflytek.util.DebugLog;

public class MySynthesizerListener implements SynthesizerListener {



	@Override
	public void onBufferProgress(int progress, int beginPos, int endPos, String info) {
		DebugLog.Log("--onBufferProgress--progress:" + progress + ",beginPos:" + beginPos + ",endPos:" + endPos);
	}

	@Override
	public void onCompleted(SpeechError error) {
		DebugLog.Log("onCompleted enter");

		String text = "";
		if (null != error) {
			DebugLog.Log("onCompleted Code：" + error.getErrorCode());
			text = error.getErrorDescription(true);
		}

//		updateText( text );
		System.out.println("阅读完成：" + text);

		DebugLog.Log("onCompleted leave");
	}

	@Override
	public void onEvent(int eventType, int arg1, int arg2, int arg3, Object obj1, Object obj2) {

	}

	@Override
	public void onSpeakBegin() {

	}

	@Override
	public void onSpeakPaused() {

	}

	@Override
	public void onSpeakProgress(int progress, int beginPos, int endPos) {
		DebugLog.Log("onSpeakProgress enter progress:" + progress + ",beginPos:" + beginPos + ",endPos:" + endPos);

//		updateText( mText.substring( beginPos, endPos+1 ) );
		System.out.println("正在阅读:" + TestAsrSpeech.mText.substring(beginPos, endPos + 1));

		DebugLog.Log("onSpeakProgress leave");
	}

	@Override
	public void onSpeakResumed() {

	}

}
